home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1985 November / Ahoy_Magazine_85-11_1985_Double_L.d64 / knight's tour (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  2KB  |  68 lines

  1. 100 rem * knight's tour / commodore 64 / ramella
  2. 101 poke 53280,0: poke 53281,0
  3. 102 print "[147][150]": v=53248: poke v+34,4: poke 53269,4: poke 2042,13
  4. 103 for n=0 to 62: read a: poke 832+n,a: next: l=53: h=28
  5. 105 print"";spc(33);"knight": print: print spc(33);"tour": print ""
  6. 106 print: print: print: print: print "":print spc(33);"score:": print "";
  7. 107 print ""
  8. 110 t$="[207][183][183][183][207][183][183][183][207][183][183][183][207][183][183][183][207][183][183][183][207][183][183][183][207][183][183][183][207][183][183][183][180]"
  9. 112 n$="[180]   [180]   [180]   [180]   [180]   [180]   [180]   [180]   [180]"
  10. 115 for x=1 to 8: print t$: print n$: print n$: next
  11. 116 print"[145][204][175][175][175][204][175][175][175][204][175][175][175][204][175][175][175][204][175][175][175][204][175][175][175][204][175][175][175][204][175][175][175]"
  12. 120 gosub 5000
  13. 150 geta$: if a$<>"a" and a$<>"z" and a$<>"," and a$<>"." and a$<>"k" then 150
  14. 152 if a$="k" then 245
  15. 155 if h=252 and a$="." then 150
  16. 160 if a$="." then for h=h to h+32 step 4
  17. 165 if h=28 and a$="," then 150
  18. 170 if a$="," then for h=h to h-32 step -4
  19. 175 if l=221 and a$="z" then 150
  20. 180 if a$="z" then for l=l to l+24 step 2
  21. 185 if l=53 and a$="a" then 150
  22. 190 if a$="a" then for l=l to l-24 step -2
  23. 200 gosub 5000: next
  24. 210 if a$="." then h=h-4: p=p+4
  25. 220 if a$="," then h=h+4: p=p-4
  26. 230 if a$="z" then l=l-2: p=p+120
  27. 235 if a$="a" then l=l+2: p=p-120
  28. 240 goto 150
  29. 245 s$="": h1=h: l1=l: p1=p
  30. 250 get a$: if a$<>"a" and a$<>"z" and a$<>"," and a$<>"." then 250
  31. 252 s$=s$+a$
  32. 255 if h=252 and a$="." then 385
  33. 260 if a$="." then for h=h to h+32 step 4
  34. 265 if h=28 and a$="," then 385
  35. 270 if a$="," then for h=h to h-32 step -4
  36. 275 if l=221 and a$="z" then 385
  37. 280 if a$="z" then for l=l to l+24 step 2
  38. 285 if l=53 and a$="a" then 385
  39. 290 if a$="a" then for l=l to l-24 step -2
  40. 300 gosub 5000: next
  41. 310 if a$="." then h=h-4: p=p+4
  42. 320 if a$="," then h=h+4: p=p-4
  43. 330 if a$="z" then l=l-2: p=p+120
  44. 335 if a$="a" then l=l+2: p=p-120
  45. 337 if len(s$)=3 then 350
  46. 340 goto 250
  47. 350 if s$="aa." or s$=".aa" or s$="a.." or s$="..a" or s$="..z" then w=1
  48. 360 if s$="z.." or s$="zz." or s$=".zz" or s$="zz," or s$=",zz" then w=1
  49. 370 if s$=",,z"or s$="z,,"or s$=",,a"or s$="a,,"or s$="aa,"or s$=",aa"then w=1
  50. 375 if peek(1024+p)=81 then 385
  51. 380 if w=1 then w=0: goto 400
  52. 385 p=p1: h=h1: l=l1: gosub 5000: w=0: goto 245
  53. 390 goto 245
  54. 400 for g=p to p+80 step 40: for r=g to g+3
  55. 410 poke 1024+r,81: poke 55296+r,14: next r,g
  56. 411 tl=tl+1: tl$=str$(tl): for jf=2 to len(tl$)
  57. 412 poke 1537+jf,asc(mid$(tl$,jf,1)): next jf
  58. 420 goto 245
  59. 5000 poke v+4,h: poke v+5,l: return
  60. 10000 data 0,31,128,0,255,224,1,255,240
  61. 10010 data 3,255,248,7,231,254,15,255,252
  62. 10020 data 31,255,252,63,255,255,127,255,252
  63. 10030 data 255,255,254,255,255,255,127,159,252
  64. 10040 data 60,15,254,0,31,255,0,31,252
  65. 10050 data 0,63,254,0,255,255,1,255,252
  66. 10060 data 7,255,254,31,255,255,63,255,255
  67. 10070 end
  68.